package CorpusConverter;

import java.io.File;
import java.io.RandomAccessFile;
import java.io.IOException;
import java.io.FileNotFoundException;

/**
 * @author Robert Pethes
 * 
 * Text corpus class.
 */

public class TextCorpus extends Corpus {
	
	private RandomAccessFile _lineReader;
	
	/**
	 * Initializes the text corpus.
	 * 
	 * @param dataFile a file containing tagged sentences.
	 * @throws FileNotFoundException
	 */
	public TextCorpus(File dataFile) throws FileNotFoundException{
		super(dataFile);
		_lineReader = new RandomAccessFile(dataFile,"r");
	}

	public String getNextSentence() throws IOException {
		
		String line = new String("");
		
		while (line.isEmpty()){
			
			line =_lineReader.readLine();
			
			//end of file
			if (line==null)
				return line;
		}
		
		return line;
	}
}
